/*
This file is part of IRCaBot.
IRCaBot is IRC logger with features.
Source code: https://notabug.org/acetone/ircabot.
Copyright (C) acetone, 2023.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <QString>
#include <QStringList>

class Token
{
public:
    Token(const QStringList& payload);
    Token(const QString& base64Token);
    bool valid() const { return m_valid; }
    QString token() const { return m_token; }
    QStringList payload() const { return m_payload; }
private:
    QString shortHash(const QByteArray& data, uint8_t shortFactor = 3);

    QString m_token;
    QStringList m_payload;
    bool m_valid = false;

    static QString m_signatureSecret;
};
